//
//  WYSuggestionController.m
//  CirclePush
//
//  Created by admin on 2018/4/17.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYSuggestionController.h"
#import "UITextView+ZWPlaceHolder.h"
@interface WYSuggestionController ()
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *topHeight;
@property (strong, nonatomic) IBOutlet UITextView *textView;
@property (strong, nonatomic) IBOutlet UITextField *textField;
@property (strong, nonatomic) IBOutlet UIButton *submissionBtn;

@end

@implementation WYSuggestionController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupUI];
    // Do any additional setup after loading the view from its nib.
}
-(void)setupUI
{
    [self initTopBarWithTitle:@"意见反馈"];
    [self addLeftButton:[UIImage imageNamed:@"return"] width:0 height:0];
    CGFloat height = 74;
    if (kDevice_Is_iPhoneX) {
        height = 98;
    }
    self.topHeight.constant = height;
    self.view.backgroundColor = [UIColor hexStringToColor:@"#F4F4F4" alpha:1.0];
    self.textView.zw_placeHolder = @"请输入您对我们的建议...";
    
    [self.submissionBtn setCornerRadius:5.0f];
    
}
- (IBAction)clickSubmissionAction:(id)sender {
    
    if (!self.textView.text.length) {
        [self toast:@"请输入反馈内容"];
    }
//    if (!self.textView.text.length) {
//        [self toast:@"请输入您的"];
//    }
    WEAKSELF
    [WYHttpServer addFeedWithWay:self.textField.text WithCoupleBack:self.textView.text SucessBlock:^(BOOL success, id response, NSString *errorMessage) {
        if (success) {
            [weakSelf toast:@"反馈成功"];
            [weakSelf.navigationController popViewControllerAnimated:YES];
            
        }else{
            [weakSelf toast:errorMessage];
        }
        
        
        
    }];
    
    
    
    
    
    
}

//-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
//{
//    [self showLoading:@"addadasdasda"];
//}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end
